<?php

namespace app\common\model;

use app\common\library\AddressCode;
use think\Model;

/**
 * 腾讯地区数据模型
 */
class TxArea extends Model
{

    // 表名
    protected $name = 'txarea';


    public static function getAddressByCode($area_code)
    {
        $arr = AddressCode::parse($area_code);
        
        $res = [];

        foreach($arr as $key => $v){
            $name = self::where('area_code', $v)->cache(300)->value('name');
            if($name){
                $res[] = $name ;
            }
        }

        return $res;
    }
}
